# -*- coding: UTF-8 -*-
import os
import re

#  os.listdir(os.path.abspath(os.path.join(os.getcwd(),'..')))
def win_to_ubuntu_filepath(win_path,require_find):
    #require_find为需要寻找的点
    # main_path=re.compile(r'(.*?)(.*?/.*?)')
    #将windows \转换为/
    win_path=win_path.replace('\\','/')
    matched_path=os.path.abspath(os.path.join(os.getcwd(),'..'))  #返回上一级目录
    while True:
        dir_dic=os.listdir(matched_path)
        #如果在子文件
        if require_find in dir_dic:
            # sample_path=os.path.join(matched_path,"Sample")
            break
        else:   #搜索错误 再次向上
            matched_path=os.path.abspath(os.path.join(matched_path,".."))

    return os.path.join(matched_path,win_path)



